/**
 * @param {number} target
 * @param {number[]} nums
 * @return {number}
 */
var minSubArrayLen = function (target, nums) {
    let left = 0
    let queueNums = 0
    let len = nums.length

    for (let index = 0; index < nums.length; index++) {
        queueNums += nums[index]
        while (queueNums >= target && left <= index) {
            len = Math.min(len, index - left + 1)
            queueNums -= nums[left]
            left++

        }

    }
    if (left != 0) return len
    return 0
};
minSubArrayLen(4, [1, 4, 4])